When photographing a subject into the sunlight, the subject portion of the image is referred to as a backlight image in which the lightness and contrast are too low to distinguish details in the image. Image processing it performed on such backlight images to improve image quality by increasing the lightness and contrast in the image. This type of image processing is not only performed on backlight images, but also poor quality images resulting from underexposure, shaking or blurring during photographing, noise, and insufficient light. One technique of this type of image processing that is well known in the art is the retinex process as described in “Improvement of Image Quality Using Retinex Theory based on Statistical Image Evaluation” by Yuki Takematsu, Journal of Photographic Science and Technology of Japan, Vol. 67, No. 4, pp 410-416, 2004.
The retinex process improves the image quality primarily of low quality image portions of inputted image data, while saving the high-quality image portions. In the retinex process, a Gaussian filter is used to calibrate pixel data in the original image to values reflecting pixel data in surrounding pixels, calculates reference component data of the original image from the natural logarithm of the calibrated pixel data, and calculates illuminance component data by dividing the pixel data of the original image by the reference component data. Thus, the retinex process divides the original image into the reference component data and the illuminance component data. Then, the retinex process performs gamma correction on the calculated illuminance component data to calibrate lightness and tone (contrast). By subsequently combining the calibrated illuminance component data and the reference component data, the retinex process can generate image data with improved image quality in the low quality portions of the original image, such as backlight regions of the image.